package com.itheima.d2_collection_nesting;

import java.util.*;

/**
 * 目标：理解集合的嵌套。
 * 江苏省 = "南京市","扬州市","苏州市“,"无锡市","常州市"
 * 湖北省 = "武汉市","孝感市","十堰市","宜昌市","鄂州市"
 * 河北省 = "石家庄市","唐山市", "邢台市", "保定市", "张家口市"
 */
public class Test {
    public static void main(String[] args) {
        // 1、定义一个Map集合存储全部的省份信息，和其对应的城市信息。
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list, "南京市","扬州市","苏州市","无锡市","常州市");
        HashMap<String,ArrayList<String>> map = new HashMap<>();
        map.put("江苏",list);
        Set<String> keySet = map.keySet();

        for (String s : keySet) {
            System.out.print(s+"省：");
            ArrayList<String> list1 = map.get(s);
            for (String s1 : list1) {
                System.out.print(s1+"\t");
            }
        }
    }
}
